<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">
	<h:form id="suchform">
	<rich:collapsiblePanel expanded="true">
	<f:facet name="header">suchen . . .</f:facet>
	<table class="searchTable">
		<tr>
			<td>Ersteller</td>
			<td><rich:inplaceSelect value="#{QuestionViewBean.creator}" openOnEdit="true">
			<f:selectItems value="#{QuestionViewBean.userIDList}"/>
			</rich:inplaceSelect></td>
			<td>Typ</td>
			<td><rich:inplaceSelect value="#{QuestionViewBean.typ}" openOnEdit="true">
			<f:selectItems value="#{QuestionViewBean.questionTypeList}"/>
			</rich:inplaceSelect></td>
		</tr>
		<tr>
			<td>ID</td>
			<td><h:inputText value="#{QuestionViewBean.id}" />
			</td>
			<td>Text</td>
			<td><h:inputText value="#{QuestionViewBean.questiontext}" />
			</td>
		</tr>
		<tr>
			<td colspan="4"><hr/></td>
		</tr>
		<tr>
			<td colspan="4"><center><a4j:commandButton id="searchButton" action="#{QuestionViewBean.refreshFilteredView()}" value="suchen" execute="suchform" render="table datascrolleroben datascrollerunten" onbegin="#{rich:component('Loadingpopup')}.show();" oncomplete="#{rich:component('Loadingpopup')}.hide();"/></center></td>
		</tr>
	</table>
	</rich:collapsiblePanel>
	</h:form>
	<center><rich:dataScroller id="datascrolleroben" for="table" maxPages="10" stepControls="auto" render="datascrollerunten"/></center>
	<h:form id="questionTableForm">
	
	<a4j:jsFunction  name="rowupdate" action="#{QuestionViewBean.innerComShow()}" actionListener="#{QuestionViewBean.selectionListener}" execute="questionTableForm" oncomplete="#{rich:component('questionDetail')}.show();" render="questionDetail">
    </a4j:jsFunction>
	<rich:extendedDataTable value="#{QuestionViewBean.questions}" binding="#{QuestionViewBean.dataTable}"
            var="questions" id="table" frozenColumns="4" rows="10"
             selectionMode="single" styleClass="questionOverviewTable"
            noDataLabel="keine Fragen verfügbar" keepSaved="false" onready="InvokeClick('searchButton')"
            rowClasses="rowstyle1,rowstyle2" selection="#{QuestionViewBean.selection}" onrowdblclick="rowupdate()">

            <f:facet name="header">
                <h:outputText value="Fragen" />
            </f:facet>
            <rich:column width="50px">
                <f:facet name="header">
                    <h:outputText value="ID" />
                </f:facet>
			<h:outputText value="#{questions.id}" />
		</rich:column>
            <rich:column>
                <f:facet name="header">
                    <h:outputText value="Typ" />
                </f:facet>
                <h:outputText value="#{questions.typ}" />
            </rich:column>
            <rich:column>
                <f:facet name="header">
                    <h:outputText value="Ersteller" />
                </f:facet>
                <h:outputText value="#{questions.user.id}" />
            </rich:column>
            <rich:column width="340px">
                <f:facet name="header">
                    <h:outputText value="Frage" />
                </f:facet>
                <h:outputText value="#{questions.text}"/>
            </rich:column>
        </rich:extendedDataTable>
        </h:form>
		<center><rich:dataScroller id="datascrollerunten" for="table" maxPages="10" stepControls="auto" render="datascrolleroben"/></center>														
		
		<ui:include src="ChangeQuestionInnerComp.xhtml"/>
		
</ui:composition>
